<template>
    <div>
        <Row type="flex" justify="start">
            <Col span="3">
                <Button type="default" long @click="backAction">返回</Button>
            </Col>
        </Row>
        <excel-action :type="templateType" :archive_id="archive_id"></excel-action>
    </div>
</template>

<script>

import ExcelAction from '@/components/excel-action-new'
export default {
  components: { ExcelAction },
  data () {
    return {
      templateType: '',
      archive_id: ''
    }
  },
  beforeMount () {
    this.templateType = this.$route.query && this.$route.query.type ? this.$route.query.type : 'record'
    // 针对个人材料excel导入加处理
    if (this.templateType === 'material') {
      if (this.$route.query && this.$route.query.archive_id) {
        this.archive_id = this.$route.query.archive_id
      } else {
        this.$Message.error('参数缺失！')
        this.$router.push({
          name: 'recordList'
        })
      }
    }
  },
  methods: {
    backAction () {
      if (this.$route.query && this.$route.query.type === 'record') {
        this.$router.push({ name: 'recordList' })
      } else if (this.$route.query && this.$route.query.type === 'material') {
        this.$router.push({ name: 'recordMaterials', query: { id: this.$route.query.archive_id } })
      } else if (this.$route.query && this.$route.query.type === 'all') {
        this.$router.push({ name: 'recordList' })
      } else if (this.$route.query && this.$route.query.type === 'whiteList') {
        this.$router.push({ name: 'userWhiteWhiteList' })
      }
    }
  },
  mounted () {}
}
</script>

<style scoped>
</style>
